package com.leyou.user.inter.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author zqq
 * @ClassName UserRegisterDTO
 * @Description
 * @date 2020/3/9-16:52
 */
@Data
@ApiModel(value = "UserRegisterDTO", description = "用户注册参数类")
public class UserRegisterDTO {

    /** 用户名 */
    @ApiModelProperty(value = "格式为4-30位字母数字，下划线", name = "username")
    @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
    private String username;

    /** 密码 */
    @ApiModelProperty(value = "密码，格式为4-30位字母数字，下划线", name = "password")
    @Length(min = 4, max = 30, message = "密码只能在4~30位之间")
    private String password;

    /** 电话号码 */
    @ApiModelProperty(value = "电话号码", name = "phone")
    @Pattern(regexp = "^1[35678]\\d{9}$", message = "手机号格式不正确")
    private String phone;

    /** 短信验证码 */
    @ApiModelProperty(value = "短信验证码", name = "code")
    @NotNull(message = "验证码不能为空")
    private String code;
}
